package com.coolwalker.common.exception;

import com.coolwalker.common.domain.ErrorCode;
import lombok.Data;

@Data
public class BizException extends RuntimeException {

    private int errorCode;

    private  String innerMessage;

    public BizException() {
        super();
    }

    public BizException(String message) {
        super(message);
    }

    public BizException(int errorCode, String message) {
        super(message);
        this.errorCode = errorCode;
    }

    public BizException(int errorCode, String message, String innerMessage) {
        super(message);
        this.errorCode = errorCode;
        this.innerMessage = innerMessage;
    }

    public BizException(int errorCode, String message, Throwable cause) {
        super(message, cause);
        this.errorCode = errorCode;
    }

    public BizException(int errorCode, String message, String innerMessage, Throwable cause) {
        this(errorCode, message, cause);
        this.innerMessage = innerMessage;
    }

    public BizException(ErrorCode errorCode) {
        this(errorCode.getCode(), errorCode.getMessage());
    }

    public BizException(ErrorCode errorCode, String innerMessage) {
        this(errorCode.getCode(), errorCode.getMessage(), innerMessage);
    }

    public BizException(ErrorCode errorCode, String innerMessage, Throwable cause) {
        this(errorCode.getCode(), errorCode.getMessage(), innerMessage, cause);
    }
}
